﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibMSNP.HTTP
{
    public sealed class MimeHeaders : System.Collections.IEnumerable
    {
        private Dictionary<string, string> _headerCollection;

        public MimeHeaders()
        {
            _headerCollection = new Dictionary<string, string>();
        }

        public string this[string key]
        {
            get
            {
                if (_headerCollection.ContainsKey(key))
                {
                    return _headerCollection[key];
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                if (_headerCollection.ContainsKey(key))
                {
                    _headerCollection[key] = value;
                }
                else
                {
                    _headerCollection.Add(key, value);
                }
            }
        }

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _headerCollection.GetEnumerator();
        }

        #endregion
    }
}

